package com.online.teaching.config;

import com.online.teaching.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @ClassName : LoginConfig  //类名
 * @Description :   //描述
 * @Author : YG  //作者
 * @Date: 2020-11-22 15:53  //时间
 */
@Configuration
@EnableWebSecurity
public class LoginConfig extends WebMvcConfigurationSupport {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器要声明拦截器对象和要拦截的请求
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/admin/**","/user/**","/teacher/**","/common/**");
    }

}
